import React, { Component } from 'react';
import './user.scss';
import { Route, Switch, Redirect} from 'react-router-dom';
import Nav from '@/components/common/nav';
import UserTop from '@/components/user/UserTop';
import UserNav from '@/components/user/UserNav';
import UserRight from '@/components/user/UserRight';
import Dynamic from '@/components/user/child/Dynamic';
import Posts from '@/components/user/child/Posts';
import Pins from '@/components/user/child/Pins';
import Shares from '@/components/user/child/Shares';
import Books from '@/components/user/child/Books';
import { BackTop } from 'antd';
class Com extends Component {
    constructor (props) {
        super(props);
        this.state = {
            list:[
                {
                    path: '/user/dynamic',
                    name: '动态'
                },
                {
                    path: '/user/child/posts',
                    name: '专栏'
                },
                {
                    path: '/user/child/pins',
                    name: '沸点'
                },
                {
                    path: '/user/child/shares',
                    name: '分享'
                },
                {
                    path: '/user/child/books',
                    name: '小册'
                }
            ]
        }
    }

    render () {
        return(

            <div className="userBox">
                
                <div>
                    <BackTop>
                        <div className="ant-back-top-inner" title="回到顶部">^</div>
                    </BackTop>
                </div>
                <div className='container'>
                    <Nav />
                </div>

                <div className="user-box">
                    <UserTop />
                    <UserNav />
                    <UserRight />
                <Switch>
                    <Route path="/user/userright" component ={ UserRight }/>
                    <Route path="/user/usernav" component ={ UserNav }/>
                    <Route path="/user/usertop" component ={ UserTop }/>
                    <Route path="/user/dynamic" component ={ Dynamic }/>
                    <Route path="/user/posts" component ={ Posts }/>
                    <Route path="/user/pins" component ={ Pins }/>
                    <Route path="/user/shares" component ={ Shares }/>
                    <Route path="/user/books" component ={ Books }/>
                    <Redirect from = "/user" to="/user/dynamic"/>
                </Switch>
                   
                </div>
            </div>
        )
    }
}
export default Com;